package com.shoesmail.enums;

import com.fasterxml.jackson.annotation.JsonValue;

public enum OrderState {
    PENDING_PAYMENT(0,"待付款"),
    HAVE_PAYMENT(1,"已付款"),
    CANCEL_ORDER(2,"取消订单"),
    PANDING_GODDS(3,"待收货"),
    FINISH(4,"已完成");

    int code;
    String desc;

    OrderState(int code,String desc){
        this.code = code;
        this.desc = desc;
    }

    public int getCode(){
        return this.code;
    }

    @JsonValue
    public String getDesc(){
        return this.desc;
    }

    public static OrderState get(int code){
        for(OrderState orderState:OrderState.values()){
            if(orderState.code==code){
                return orderState;
            }
        }
        return null;
    }
}










